package com.yandadeyu.springBoot.domain;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
import java.nio.file.SimpleFileVisitor;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.logging.SimpleFormatter;

/**
 * Created by Administrator on 2018/6/12.
 * @Transient  对属性加入这个修饰符 序列化的时，不对该属性序列化
 */
@Entity(name="customer")
public class Customer  implements Serializable{
    private static final long serialVersionUID = 1L;
    // @Id的注解引入的是 javax.persistence包的类
    @Id
    @GeneratedValue
    private Long id;
    @Column(nullable = false, unique = true)
    private String userName;
    @Column(nullable = false)
    private String passWord;
    @Column(nullable = false, unique = true)
    private String email;
    @Column(nullable = true, unique = true)
    private String nickName;
    @Column(nullable = false)
    private Timestamp regTime;

    public Customer() {
    }

    public Customer(String userName, String passWord, String email, String nickName, Timestamp regTime) {
        this.userName = userName;
        this.passWord = passWord;
        this.email = email;
        this.nickName = nickName;
        this.regTime = regTime;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public Timestamp getRegTime() {
        return regTime;
    }

    public void setRegTime(Timestamp regTime) {
        this.regTime = regTime;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Override
    public String toString() {
        return "userName:"+userName+" passWord:"+passWord+" email:"+email+" nickName:"+nickName+" regTime:"+ new  SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(regTime);
    }
}
